<?php
include_once('../includes/definer.php');
include_once(INC.'admin/php/bootstrap.php');
include_once(INC.'admin/php/clases/Texto.php');
$alea = rand(1, 999);
$results = array();
$sliders = Doctrine::getTable('slider')->findAll();
foreach ($sliders as $slider) {
    $n = array();
    $n['alea'] = $alea;
    $n['id'] = $slider->id;
    $n['titulo'] = utf8_encode($slider->getTitulo());
    $n['descripcion'] = Texto::cortar(utf8_encode($slider->getLeyenda()), 89, '...');
    $n['portada'] = $slider->portada->src;
    $n['url'] = URL;
    $results[] = $n;
}
$results = json_encode($results);
header("Content-type: application/json");
echo($results);
?>